//Tue Jun  7 14:05:17 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class BadNeighbors {
public:
	int maxDonations(vector <int>);
};

int BadNeighbors::maxDonations(vector <int> dos) {
	int N = dos.size();
	int ret = 0;
	for(int i=0; i<N; i++){
		vector<int> cost(N, 0);
		cost[0] = dos[0];
		cost[1] = dos[1];
		ret = max(ret, cost[0]);
		ret = max(ret, cost[1]);
		for(int j=2; j<N-1; j++){
			cost[j] = max(cost[j-1], cost[j-2] + dos[j]);
			ret = max(ret, cost[j]);
		}
		
		rotate(dos.begin(), dos.begin() + 1, dos.end());
	}
	return ret;
}


//Powered by [KawigiEdit] 2.0!
